<template>
	<view>
		
<view class="dd" v-for="item in items" :class="{'active' :item.id == currentIndex}" @click="change(item)">
	{{item.name}}
</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				items:[
					{
					id:3,
					name:'标题三'
				},
				{
					id:5,
					name:'标题五'
				},
				{
					id:7,
					name:'标题七'
				}
				],
			currentIndex:0,	
			};
		},
		onLoad() {
			var that = this;
			
			/*  const res = uni.getSystemInfoSync();
			    this.style.pageHeight = res.windowHeight;
			    this.style.contentViewHeight = res.windowHeight - uni.getSystemInfoSync().screenWidth / 750 * (100); //像素
 */
	      }
		  ,methods:{
			  change:function(id){
				  console.log(id);
				  var that = this ;
				  that.currentIndex = id.id;
				  console.log(that.currentIndex);
			  }
		  }
	}
</script>

<style>
.active{
	background: red;
}
.dd{
	height: 100rpx;
}
</style>
